package org.bees.cms.core.style;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;

import org.bees.cms.core.clause.Criterion;
import org.bees.cms.core.clause.Restriction;
import org.bees.cms.core.clause.Sorting;

@Entity
public class Template extends Style {
	private static final long serialVersionUID = -2837579120907626132L;

	private String directory;
	private String prefix;
	private String suffix;
	private String mapper;
	private Criterion criterion;
	private Sorting sorting;
	private Restriction restriction;
	private String content;
	private Scope scope;
	private Theme theme;

	@Column(length = 100, nullable = false)
	public String getDirectory() {
		return directory;
	}

	public void setDirectory(String directory) {
		this.directory = directory;
	}

	@Column(length = 24, nullable = false)
	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	@Column(length = 24, nullable = false)
	public String getSuffix() {
		return suffix;
	}

	public void setSuffix(String suffix) {
		this.suffix = suffix;
	}

	@Column(length = 24)
	public String getMapper() {
		return mapper;
	}

	public void setMapper(String mapper) {
		this.mapper = mapper;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH })
	public Criterion getCriterion() {
		return criterion;
	}

	public void setCriterion(Criterion criterion) {
		this.criterion = criterion;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH })
	public Sorting getSorting() {
		return sorting;
	}

	public void setSorting(Sorting sorting) {
		this.sorting = sorting;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH })
	public Restriction getRestriction() {
		return restriction;
	}

	public void setRestriction(Restriction restriction) {
		this.restriction = restriction;
	}

	@Lob
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Enumerated(EnumType.STRING)
	@Column(length = 10, nullable = false)
	public Scope getScope() {
		return scope;
	}

	public void setScope(Scope scope) {
		this.scope = scope;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH }, optional = false)
	public Theme getTheme() {
		return theme;
	}

	public void setTheme(Theme theme) {
		this.theme = theme;
	}

}
